<template>
  <div class="home">
    <el-container>
      <el-main>
        <div class="contant">
          <div class="left">
            <div class="title">
              <span>标 题</span>
              <input type="text" key="">
            </div>
            <Mirr ref="mirr" />
          </div>
          <!-- 通过command进行导图和MD切换 -->
          <div class="right">
            <Markdown v-show="this.$route.query.command == 'a'" />
            <Markmap v-show="this.$route.query.command == 'b'" />
          </div>
        </div>
      </el-main>
    </el-container>
    <div>
      <button class="btn" @click="save">保 存 文 档</button>
    </div>
  </div>
</template>

<script>
import Mirr from "@/components/Mirr.vue";
import Markdown from "@/components/Markdown.vue";
import Markmap from "@/components/Markmap.vue";
import List from "@/views/List.vue";

export default {
  name: "Home",
  components: {
    List,
    Mirr,
    Markdown,
    Markmap,
  },
  data() {
    return {
      command: "",
      mindVO: {
        article: "",
        id: "",
        title: "",
        type: 0,
      },
    };
  },
  mounted() {
    // 收到的query参数
    // console.log(this.$route.query.command);
    this.command = this.$route.query.command;
  },
  methods: {
    save() {
      this.mindVo = {
        article:this.$refs.mirr.item.content,
        id: "",
        title: "我们",
        type: 0,
      }
      this.$store.dispatch("saveOrUpdateList", this.mindVo);
    },
  },
};
</script>

<style lang="less">
.header-container {
  font-size: 30px;
}
.el-header {
  background-color: #2b3245;
  color: #fff;
  text-align: center;
  height: 50px !important;
  line-height: 50px;
  padding: 0 20px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  height: 600px;
  padding: 0;
  margin: 0;
}
.contant {
  width: 100%;
  display: flex;
  .left {
    width: 50%;
    height: 100%;
    background: #ddd;
    .title{
      width: 100%;
      height: 30px;
      line-height: 30px;
      // background-color: #2b3245;
      span{
        width: 10%;
        font-size:24px;
        margin-left: 25px;
        margin-right: 10px;
      }
      input{
        width: 80%;
        height:30px;
        border: none;
      }
    }
  }
  .right {
    width: 50%;
    height: 100%;
    // border: 1px solid rgb(233, 231, 231);
  }
}
.btn {
  width: 100%;
  height: 30px;
  background-color: #2b3245;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  border: none;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
</style>